//
//  YYCheckCarVC.m
//  drivingSchool
//
//  Created by 子yu 刘 on 2018/8/13.
//  Copyright © 2018年 子yu 刘. All rights reserved.
//

#import "YYCheckCarVC.h"
#import "YYCheckCell.h"

@interface YYCheckCarVC ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,strong)NSArray * inspectArr;
@property (nonatomic,strong)NSArray * teamArr;

@end

@implementation YYCheckCarVC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self getData];
}

-(void)getData{
//    [RequestOperationManager personalOrder_type:@"2" success:^(id result) {
//        
//        if (DEF_REQ_SUCCESS) {
//            self.inspectArr = result[@"data"][@"inspect"];
//            self.teamArr = result[@"data"][@"team"];
//            
//            if (self.inspectArr.count+self.teamArr.count == 0) {
//                self.baseLabel.text = @"暂无订单";
//                self.baseImageView.hidden = NO;
//            }else{
//                [self.tableView reloadData];
//            }
//        }
//        
//    } failture:^(NSError *error) {
//        
//    }];
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 2;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    if (section == 0) {
        return self.inspectArr.count;
    }else if (section == 1) {
        return self.teamArr.count;
    }
    return 0;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    YYCheckCell * cell = [tableView dequeueReusableCellWithIdentifier:@"YYCheckCell"];
    if (indexPath.section == 0) {
         NSDictionary * itme = self.inspectArr[indexPath.row];
        cell.lbType.text = @"个人检车";
        cell.lbDate.text = [NSString stringWithFormat:@"预约时间：%@",itme[@"add_time"]];
        cell.dateHeight.constant = 36;
        if ([itme[@"inspect_type"] isEqualToString:@"0"]) {
            cell.lbNum.text =@"取车方式：个人送达";
        }else{
           cell.lbNum.text =@"取车方式：上门取车";
        }
      
    }
    if (indexPath.section == 1) {
          NSDictionary * itme = self.teamArr[indexPath.row];
        cell.lbType.text = @"团队检车";
        cell.dateHeight.constant = 10;
        cell.lbDate.text = @"";
         cell.lbNum.text =[NSString stringWithFormat:@"检车数量：%@辆",itme[@"number"]];
    }
    return cell;
}

-(NSArray *)inspectArr{
    if (!_inspectArr) {
        _inspectArr = [NSArray array];
    }
    return _inspectArr;
}
@end
